﻿#region Copyright ©2008-2011, Technische Universitaet Muenchen
// ====================================================================================================
//
// Last Changed by       $Author: then $
// Last Changed Date     $LastChangedDate: 2009-12-16 16:37:27 +0100 (Wed, 16 Dec 2009) $
// Last Changed Revision $Rev: 504 $
//
// ====================================================================================================
#endregion

using System.Xml;

namespace Tum.CollabXT.VModellXT
{
    public class Role : ProcessElement, IRole
    {
        public Role() { }
        public Role(XmlNode node) 
        {
            Id = node.Attributes["id"].Value;
            Name = node.SelectSingleNode("Name").InnerText;

            XmlNode descNode = node.SelectSingleNode("Beschreibung");
            Description = descNode != null ? Helper.GetTextFromHtmlString(descNode.InnerXml) : string.Empty;

            XmlNode profileNode = node.SelectSingleNode("Aufgaben_und_Befugnisse");
            Profile = profileNode != null ? Helper.GetTextFromHtmlString(profileNode.InnerXml) : string.Empty;

            XmlNode staffingNode = node.SelectSingleNode("Fähigkeitsprofil") ?? node.SelectSingleNode("Rollenbesetzung");
            if(staffingNode != null)
                Staffing = Helper.GetTextFromHtmlString(staffingNode.InnerXml);
        }

        #region IRole Members

        public string Profile
        {
            get; set;
        }

        public string Staffing
        {
            get; set;
        }

        #endregion
    }
}
